import Image from "components/Base/Image";
import {memberLevelDict, memberLevelGetName} from "../../../../models/MemberLevel";
import moment from "moment";
import Button from "components/Base/Button";
import Icon from "components/Base/Icon";
import DataTable from "components/Base/DataTable";

export default (self) => [

  {
    title: 'id',
    name: 'id',
    formItem: {
      type: 'hidden',
    }
  },
  {
    title: '公司名字',
    name: 'name',
    tableItem: {},
    formItem: {
      rules: [
        {
          required: true,
          message: '请输入公司名字'
        }
      ]
    }
  },

  {
    title: '店铺名字',
    name: 'shopName',
    tableItem: {},
    formItem: {
      rules: [
        {
          required: true,
          message: '请输入店铺名字'
        }
      ]
    }
  },

  {
    title: '公司电话',
    name: 'telephone',
    tableItem: {},
    formItem: {
      rules: [
        {
          required: true,
          message: '请输入公司电话'
        }
      ]
    }
  },

  {
    title: '详细地址',
    name: 'addressDetail',
    tableItem: {},
    formItem: {
      rules: [
        {
          required: true,
          message: '请输入详细地址'
        }
      ]
    }
  },

  {
    title: '联系人姓名',
    name: 'linkmanName',
    tableItem: {},
    formItem: {
      rules: [
        {
          required: true,
          message: '请输入联系人姓名'
        }
      ]
    }
  },

  {
    title: '联系人电话',
    name: 'linkmanMobile',
    tableItem: {},
    formItem: {
      rules: [
        {
          required: true,
          message: '请输入联系人电话'
        }
      ]
    }
  },

  {
    title: '员工列表',
    name: 'sellerEmployee',
    tableItem: {
      render: (text, record) => {
        const view =
          <DataTable.Oper>
            <a onClick={e => {
              self.props.showSellerEmployee(record.id);
            }}>
              <span>查看员工列表</span>
            </a>
          </DataTable.Oper>
        return (
          view
        );
      }
    },
  },

  {
    title: '操作',
    tableItem: {
      width: 180,
      align: 'center',
      render: (text, record) => (
        <DataTable.Oper>
          <Button tooltip="修改" onClick={e => self.onUpdate(record)}>
            <Icon type="edit"/>
          </Button>
          <Button tooltip="删除" onClick={e => self.onDelete(record)}>
            <Icon type="trash"/>
          </Button>
        </DataTable.Oper>
      )
    }
  }
]
